/**
 * Copyright (C), 2020-2021,贵州铭明网络科技有限公司
 * FileName: Pay
 * Author:   杨朝湖
 * Date:     2021/3/11 16:26
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.gym.util.base;

import com.alipay.api.*;
import com.gym.util.config.AliPayApiConfig;

/**
 * 〈一句话功能简述〉<br>
 * 〈〉
 *
 * @author Gym
 * @create 2021/3/11
 * @since 1.0.0
 */
public class Pay {
    /**
     * 处理请求对象
     *
     * @param config {@link AliPayApiConfig}
     * @return {@link AlipayClient}
     * @throws AlipayApiException 支付宝 Api 异常
     */
    protected static AlipayClient alipayClient(AliPayApiConfig config) throws AlipayApiException {
        AlipayClient alipayClient = new DefaultAlipayClient(config.getServiceUrl(),
                config.getAppId(), config.getPrivateKey(), config.getFormat(),
                config.getCharset(), config.getAliPayPublicKey(),
                config.getSignType());
        return alipayClient;
    }
}